<%-- 
    Document   : content_buynow
    Created on : Jan 5, 2012, 8:10:05 AM
    Author     : Ngoc Linh
--%>

<%@page import="net.tanesha.recaptcha.ReCaptchaFactory"%>
<%@page import="net.tanesha.recaptcha.ReCaptcha"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib  prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>

<div class="main_content_panel" id="box_buynow">
    <p class="top_main_content_panel">
        Mua ngay sản phẩm
    </p>
    <div class="content_main_content_panel">
        <c:if test="${requestScope.sucMessage ne null}">
            <p class="message">${requestScope.sucMessage}</p>
        </c:if>
        <c:if test="${requestScope.errMessage ne null}">
            <p class="noHiddenMessage">${requestScope.errMessage}</p>
            <c:remove var="errMessage" scope="request"/>
        </c:if>    
        <c:if test="${requestScope.errorCaptcha ne null}">
            <p class="noHiddenMessage">${requestScope.errorCaptcha}</p>
            <c:remove var="errorCaptcha" scope="request"/>
        </c:if>
        <fieldset>
            <legend>Thông tin người đặt hàng</legend>
            <table width="100%" class="user_info">
                <tr>
                    <td class="label">
                        Họ và tên
                    </td>
                    <td class="value">
                        <c:if test="${requestScope.thongtinTK.hoTen ne null}">
                            ${requestScope.thongtinTK.hoTen}
                        </c:if>  
                        <c:if test="${requestScope.thongtinTK.hoTen eq null}">
                            ---
                        </c:if>  
                    </td>
                </tr>
                <tr>
                    <td class="label">
                        Số điện thoại
                    </td>
                    <td class="value">                        
                        <c:if test="${requestScope.thongtinTK.soDienThoai ne null}">
                            ${requestScope.thongtinTK.soDienThoai}
                        </c:if>  
                        <c:if test="${requestScope.thongtinTK.soDienThoai eq null}">
                            ---
                        </c:if> 
                    </td>
                </tr>
                <tr>
                    <td class="label">
                        Địa chỉ
                    </td>
                    <td class="value">
                        <c:if test="${requestScope.thongtinTK.diaChi ne null}">
                            ${requestScope.thongtinTK.diaChi}
                        </c:if>  
                        <c:if test="${requestScope.thongtinTK.diaChi eq null}">
                            ---
                        </c:if> 
                    </td>
                </tr>
                <tr>
                    <td class="label">
                        Email
                    </td>
                    <td class="value">
                        <c:if test="${requestScope.thongtinTK.email ne null}">
                            ${requestScope.thongtinTK.email}
                        </c:if>  
                        <c:if test="${requestScope.thongtinTK.email eq null}">
                            ---
                        </c:if>
                    </td>
                </tr>
            </table> 
        </fieldset> 
        <fieldset>
            <legend>Thông tin thanh toán và giao hàng</legend>
            <div class="cart-info">
                <c:if test="${requestScope.sanpham.thongTinThanhToan ne null}">
                    ${requestScope.sanpham.thongTinThanhToan}
                </c:if>
                <c:if test="${requestScope.sanpham.thongTinThanhToan eq null}">
                    Người đăng không để lại thông tin thanh toán !
                </c:if>
            </div>
        </fieldset>
        <fieldset>
            <legend>Thông tin đơn hàng</legend>
            <div class="cart-info">
                <table>
                    <thead>
                        <tr bgcolor="#d9d9d9" style="font-weight: bold;height: 28px;">
                            <td style="text-align: center;">STT</td>
                            <td>Tên sản phẩm</td>
                            <td>Giá đấu khởi điểm</td>
                            <td>Giá đấu hiện tại</td>
                            <td>Giá mua ngay</td>                            
                        </tr>
                    </thead>
                    <tbody>
                        <tr style="height: 25px;">
                            <td align="center">1</td>
                            <td>                                    
                                <a href="product.do?masp=${requestScope.sanpham.maSanPham}">${requestScope.sanpham.tenSanPham}</a>
                            </td>
                            <td><fmt:formatNumber value="${requestScope.sanpham.giaKhoiDiem}" pattern="#,###"></fmt:formatNumber> VNĐ</td>
                            <td><fmt:formatNumber value="${requestScope.sanpham.giaHienTai}" pattern="#,###"></fmt:formatNumber> VNĐ</td>
                            <td><fmt:formatNumber value="${requestScope.sanpham.giaMuaNgay}" pattern="#,###"></fmt:formatNumber> VNĐ</td>
                        </tr>
                        <tr style="height: 40px;">
                            <td align="right" colspan="4" style="font-weight: bold;text-align: right;padding-right: 15px;">Giá trị đơn đặt hàng </td>
                            <td><b style="color: red;padding-left: 5px;border: none;"><fmt:formatNumber value="${requestScope.sanpham.giaMuaNgay}" pattern="#,###"></fmt:formatNumber> VNĐ</b></td>
                        </tr>                        
                    </tbody>
                </table>
            </div> 
        </fieldset>
        <form action="" method="post" onsubmit="return checkCaptcha();">
            <div class="cart-info" style="border-bottom: 1px dotted #b4b4b4;">
                <table style="border: none;">
                    <tr>
                        <td style="width: 27%;font-size: 12px;border: none;">Mã xác nhận mua hàng</td>
                        <td  style="border: none;">
                            <%
                                ReCaptcha c = ReCaptchaFactory.newReCaptcha("6LerlcgSAAAAAAP0l7ODPRSoZZwAqGR79M3DDduc ", "6LerlcgSAAAAAKtqZ-i0pyUjyydapnlv2emH1UBD", false);
                                out.print(c.createRecaptchaHtml(null, null));
                            %>
                            <br />
                            <span id="invalid_captcha" style="color: red;padding: 5px; font-size: 12px;"></span>
                        </td>
                    </tr>
                </table>
            </div>
            <div class="btn_control">

                <p style="text-align: center;">
                    <input type="submit" value="Đặt mua" name="datmua" class="btn_cm_common"/>
                    <input type="button" value="Hủy bỏ" name="huy" onclick="goBack();" class="btn_cm_common"/>
                </p>                    
            </div>
        </form>    
    </div>
</div>
